<%
var title= isEmpty(userAccount.id)?"新增":"编辑";
layout("/common/layout.html",{"title":title+"会员"}){
%>
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-sm-8">
        <h2>${title}工作流模板</h2>
        <ol class="breadcrumb">
            <li><a href="${ctxPath}/admin/main">主页</a></li>
            <li><a href="${ctxPath}/flow/view/index">事项流程管理</a></li>
            <li>流程列表</li>
            <li class="active">${title}流程模板</li>
        </ol>
    </div>
    <div class="col-sm-4">
        <div class="title-action">
            <a class="btn btn-primary btn-sm btn-outline" href="${ctxPath}/flow/view/index">
                <i class="fa fa-reply"> </i> 返回列表</a>
        </div>
    </div>
</div>
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins animated fadeInDown">
        <div class="ibox-content" id="step-box">
            <%
            if(isNotEmpty(flowTemplateList)){
            for(flowTemplate in flowTemplateList){
            %>
            <form class="form-horizontal" name="flowTemplateForm" id="flowTemplate_${flowTemplateLP.index}" method="post" role="form">
                <input value="${flowId}" name="flowId" type="hidden">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <b class="text step-title">流程步骤${flowTemplateLP.index}：</b>
                        <div class="pull-right">
                            <button onclick="$(this).parents('.panel').remove()" class="btn btn-danger">&nbsp;删除&nbsp;</button>
                        </div>
                    </div>
                    <div class="panel-body">
                        <div class="form-group">
                            <div class="col-sm-3">
                                <label class="control-label">步骤名称：</label>
                                <input name="stepName" class="form-control" type="text" maxlength='30' value="${flowTemplate.stepName}" placeholder="请输入步骤名称" aria-required="true" required="required">
                            </div>
                            <div class="col-sm-3">
                                <label class="control-label">步骤编码：</label>
                                <input name="stepCode" class="form-control" type="text" value="${flowTemplate.stepCode}" placeholder="请输入步骤编码" aria-required="true" required="required">
                            </div>
                            <div class="col-sm-3">
                                <label class="control-label">办理角色编号：</label>
                                <input name="roleId" class="form-control" type="number" value="${flowTemplate.roleId}" placeholder="请输入办理角色编号" aria-required="true" required="required">
                            </div>
                             <div class="col-sm-3">
                                <label class="control-label">步骤排序：</label>
                                <input name="stepOrder" class="form-control" type="number" value="${flowTemplate.stepOrder}" placeholder="请输入步骤顺序" aria-required="true" required="required">
                            </div>
                        </div>
                        <div class="form-group">
                              <div class="col-sm-3">
                                <label class="control-label">待办理-状态码：</label>
                                <input name="claim" class="form-control" type="number" value="${flowTemplate.claim}" placeholder="请输入认领的状态码" aria-required="true" required="required">
                            </div>
                               <div class="col-sm-3">
                                <label class="control-label">办理中-状态码：</label>
                                <input name="handle" class="form-control" type="number" value="${flowTemplate.handle}" placeholder="请输入办理的状态码" aria-required="true" required="required">
                            </div>
                             <div class="col-sm-3">
                                <label class="control-label">拒绝办理-状态码：</label>
                                <input name="refuse" class="form-control" type="number" value="${flowTemplate.refuse}" placeholder="请输入拒绝的状态码" aria-required="true" required="required">
                            </div>
                               <div class="col-sm-3">
                                <label class="control-label">同意办理-状态码：</label>
                                <input name="pass" class="form-control" type="number" value="${flowTemplate.pass}" placeholder="请输入同意的状态码" aria-required="true" required="required">
                            </div>
                        </div>
                    </div>
                </div>
            </form>
            <%
            }
            }else{
            %>
            <h3 class="text text-center text-danger">暂无流程步骤！</h3>
            <%
            }
            %>
        </div>
        <div class="ibox-footer">
            <div class="col-sm-offset-3 clearfix">
                <div class="block col-sm-2">
                    <a href="/flow/view/index" class="btn btn-white btn-block"><i class="fa fa-times"></i>&ensp;取消</a>
                </div>
                <div class="block col-sm-3">
                    <button id="addStep" class="btn btn-warning btn-block"><i class="fa fa-plus-circle"></i>&ensp;添加步骤</button>
                </div>
                <div class="block col-sm-2">
                    <button id="doSubmit" class="btn btn-primary btn-block"><i class="fa fa-check"></i>&ensp;保存</button>
                </div>
            </div>
        </div>


    </div>

</div>
<% } %>
<script type="text/javascript">
    //页面JS调用
    require(['flow/flow'], function (flow) {
        flow.template(${flowId!});
    });

</script>